Add Google-style docstrings to auto_round core modules and data_type/utils#1559
Add Google-style docstrings to auto_round core modules and data_type/utils#1559
Conversation
- autoround.py: add module docstring; improve _sampling_inputs docstring with typed Args, optional param notes, and Returns section - wrapper.py: add module docstring; add class/method docstrings to WrapperWALayer, WrapperLayerNorm, WrapperLlamaNorm, WrapperMultiblock; fix incorrect unwrapper_layer and unwrapper_block docstrings that described wrong parameters (block/vs/min_scales/max_scales) No code logic was changed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add module-level docstrings to both files - Add docstrings to all public functions, methods, and classes - Document Args, Returns, and Raises for each item - No code logic changes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…havior - 'normalises' → 'normalizes' - 'ANSI-coloured' → 'ANSI-colored' - Clarify that OutputFormat.check_scheme_args base implementation always returns True Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add module-level docstrings and Google-style method/function docstrings to four core Python files without altering any code logic: - auto_round/schemes.py: module docstring; QuantizationScheme class and all its methods (from_dict, get_attributes, __getitem__, __setitem__, items, keys, values, get, __eq__); improved is_preset_scheme, _handle_special_schemes, and get_gguf_scheme. - auto_round/sign_sgd.py: module docstring; _RequiredParameter.__repr__, _use_grad_for_differentiable decorator, SignSGD.__setstate__; improved sgd and _single_tensor_sgd. - auto_round/envs.py: module docstring; __getattr__, __dir__; improved is_set. - auto_round/alg_ext.py: module docstring; wrapper_autoround, qdq_mxfp, mx_init, nv_fp4, nv_init, make_qp_quants, make_qp_new_quants, _register_act_max_hook_ext; improved wrapper_block_v2 and dq_wrapper_block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add or improve module-level, function-level, and inner-function docstrings
across all nine files in auto_round/data_type/:
- __init__.py : module docstring
- register.py : module docstring; expand register_dtype / inner register docs
- utils.py : module docstring; document get_gaudi_fp8_ste_func,
update_fused_layer_global_scales and its inner helpers,
update_block_global_scale_if_needed, pad_sym, pad_bits
- int.py : module docstring; document search_scales
- fp8.py : module docstring
- mxfp.py : module docstring; document quant_element
- nvfp.py : module docstring; document cast_to_fp4, get_reciprocal,
calculate_gparam, ref_nvfp4_quant, nv_fp4,
nv_fp4_with_static_gs, float_to_e5m3_frexp,
e5m3_to_float_tensor, cast_to_ue5m3, cast_to_ue5m3_ste,
ref_fp4_quant, fp4_v2_with_global_scale, fp4_v2
- w4fp8.py : module docstring
- gguf.py : module docstring; document double_quant_tensor,
double_quant_tensor_sym, double_quant_tensor_sym_rtn,
make_qp_quants, _imatrix_handle_zero,
search_gguf_scale_min_asym, iterative_wls_quant_search_chunk,
search_gguf_scale_min_sym
No logic changes; docstrings only.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ributed.py - Add module docstring to utils/__init__.py - Add docstring to patch_load_dataset in utils/__init__.py - Add module docstring to utils/distributed.py - Add docstring to is_distributed in utils/distributed.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Added/improved module-level, class, and function docstrings following Google-style format for: - auto_round/utils/__init__.py - auto_round/utils/common.py - auto_round/utils/distributed.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Improve STE function docstrings in utils.py to use proper Google-style format with typed Args and Returns sections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot check the new updated files. |
Agent-Logs-Url: https://github.com/intel/auto-round/sessions/0214275a-ec6c-45e7-9408-cbfce179788a Co-authored-by: chensuyue <51692656+chensuyue@users.noreply.github.com>
Checked all 20 updated files. Several files had gained new functions/classes from the upstream merge that were missing docstrings. Fixed in commit
All files now have 0 missing docstrings and pass syntax validation. |
|
@copilot /explain "GenerationMixin" is not defined |
Agent-Logs-Url: https://github.com/intel/auto-round/sessions/0b1a8042-2416-4eeb-a7c1-51487bc3772b Co-authored-by: chensuyue <51692656+chensuyue@users.noreply.github.com>
This was a bug introduced by my previous commit Fixed in commit |
Signed-off-by: chensuyue <suyue.chen@intel.com>
for more information, see https://pre-commit.ci
Description
Adds and improves Google-style docstrings across Python files in
auto_round/— covering module-level descriptions, classAttributessections, and functionArgs/Returns/Raisesdocumentation that was missing or incomplete. A follow-up pass also ensured that new functions and classes introduced by upstream merges into the updated files were covered.Also fixes a bug introduced during docstring addition: the
from transformers.generation.utils import GenerationMixinlocal imports were accidentally dropped from both_fixed_prepare_inputs_for_generationinner functions inutils/common.py(patching Qwen2.5-Omni and Qwen3-Omni MoE talkers), causing aNameErrorat runtime. Both imports have been restored.Files updated:
autoround.py,wrapper.py,calib_dataset.py,formats.py,schemes.py,sign_sgd.py,alg_ext.py,envs.pyauto_round/data_type/—int.py,fp8.py,mxfp.py,nvfp.py,w4fp8.py,gguf.py,register.py,utils.py,__init__.pyauto_round/utils/—common.py,distributed.py,__init__.pyPost-merge gap-fill (new upstream symbols that received docstrings):
autoround.py—__init__methods onAutoRoundLLM,AutoRoundAdam,AutoRoundMLLM,AutoRoundDiffusionalg_ext.py—_get_loss_ext,get_act_max_hook,get_imatrix_hookwrapper.py—weight/biasproperties and inner_set_dict_attrsign_sgd.py—_use_gradinner function andSignSGD.__init__formats.py— class docstrings forFakeFormat,LLMCompressorFormat,AutoGPTQFormat,AutoAWQFormat,GGUFFormat,FP8Format,AutoRoundFormat; method docstrings for allcheck_scheme_args,check_and_reset_format, andgguf_args_checkcalib_dataset.py— all inner helpers (register,default_tokenizer_function,is_instruct_tokenizer,tokenize_example_batch,load_local_data,filter_func,concat_dataset_element,collate_batch)utils/common.py—normalize_no_split_modules,_patched_convert,_tensor_get_dtype,_fixed_prepare_inputs_for_generation(×2),GlobalState,is_transformers_version_greater_or_equal_5_4_0,is_transformers_version_greater_or_equal_4,_val,_dict,patchedExample (before/after):
Remaining files in
auto_round/utils/(model, device, weight_handler, offload, missing_tensors),auto_round/compressors/,auto_round/auto_scheme/,auto_round/export/,auto_round/modeling/, andauto_round_extension/still need coverage.Type of Change
Related Issues
Checklist Before Submitting
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.